package com.yangye.otherdemo.arraylistdemo;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yangye
 * @date 2020/03/31
 */
public class ArrayListDemo {
	public static List<MyObject> list = new ArrayList<>();

	public static void main(String[] args) {
		/**
		 * 内存图
		 * o     --->   new MyObject()
		 * list
		 */
		
		MyObject o = new MyObject();
		o.setS("sss");
		list.add(o);
		o.setS("ttt");
		o = null;
		System.out.println(list);
	}


}

class MyObject {
	private String s;

	public String getS() {
		return s;
	}

	public void setS(String s) {
		this.s = s;
	}

	@Override
	public String toString() {
		return "MyObject{" +
				"s='" + s + '\'' +
				'}';
	}
}